SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
12 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
1.8 KB · 23 lines tsx
Raw Blame History
1import { ImageResponse } from 'next/og';2import { Fallback, Wallpaper } from '@/components/brand/og';3import { apiD1, safe } from '@/lib/api';4import { fmtDate, fmtInt, fmtParams, num } from '@/lib/format';5import { routes, SITE_NAME } from '@/lib/site';67export const runtime = 'nodejs';8export const alt = `Model family on ${SITE_NAME}`;9export const size = { width: 1200, height: 630 };10export const contentType = 'image/png';1112export default async function FamilyOgImage({ params }: { params: Promise<{ slug: string }> }) {13  const { slug } = await params;14  const f = await safe(apiD1.family(slug, 5));15  if (!f) return new ImageResponse(<Fallback label="Family" />, { ...size });16  const counters: [string, string][] = [['Models', fmtInt(f.model_count)]];17  if (f.first_release) counters.push(['First release', fmtDate(f.first_release)]);18  if (f.last_release) counters.push(['Latest release', fmtDate(f.last_release)]);19  if (f.param_range && num(f.param_range.min) !== null && num(f.param_range.max) !== null) counters.push(['Parameters', num(f.param_range.min) === num(f.param_range.max) ? fmtParams(f.param_range.min) : `${fmtParams(f.param_range.min)} – ${fmtParams(f.param_range.max)}`]);20  const subtitle = [f.modalities?.length ? f.modalities.join(', ') : null, f.licenses?.length ? `licences: ${f.licenses.slice(0, 3).map((l) => l.key).join(', ')}` : null, num(f.artifacts_count) ? `${fmtInt(f.artifacts_count)} artifacts` : null].filter(Boolean).join(' · ') || 'Releases, members, lineage and benchmark progress.';21  return new ImageResponse(<Wallpaper eyebrow={f.organization ? `Family · ${f.organization.name}` : 'Model family'} title={f.name} subtitle={subtitle} counters={counters.slice(0, 4)} footer={`www.ai-atlas.co${routes.family(f.slug)}`} markPx={220} />, { ...size });22}23